package services

import (
	"context"
	"k8sdev/pkg/client"
	"log"

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/watch"
)

func WatchPods(namespaceName string) (w watch.Interface, err error) {
	//clientSet客户端
	err = client.NewClient()
	if err != nil {
		log.Fatal(err.Error())
		return
	}
	client := client.GetClientSet()
	//watch
	w, err = client.CoreV1().Pods(namespaceName).Watch(context.Background(), metav1.ListOptions{})
	if err != nil {
		log.Fatal(err.Error())
		return
	}

	return
}
